package com.yanqu.road.server.timer.dataanalytics;

import com.yanqu.road.server.manager.CrossDataAnalyticsMgr;
import com.yanqu.road.utils.LocalDateTimeHelper;
import com.yanqu.road.utils.executor.GeneralTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Cross2DataAnalyticsTask extends GeneralTask {

    private Logger logger = LogManager.getLogger(Cross2DataAnalyticsTask.class.getName());

    private long lastLoadTime = LocalDateTimeHelper.getZeroTimeTimeStamp();

    @Override
    public void doRun() {

        try {
            long zeroTime = LocalDateTimeHelper.getZeroTimeTimeStamp();
            if (lastLoadTime < zeroTime) {
                lastLoadTime = zeroTime;

            }

            CrossDataAnalyticsMgr.provider.flush();

        }catch (Exception e){
            logger.error("", e);
        }

    }
}
